/**
 * @USER: Administrator
 * @DATE: 2024/9/21 下午12:43
 * @VERSION: 1.0.0
 */
public class LC1299 {
    public static void main(String[] args) {

    }

    public int[] replaceElements(int[] arr) {
        int curMax = -1;
        for (int i = arr.length-1; i>=0; i--) {
            int tmp = arr[i];
            arr[i] = curMax;
            if (tmp > curMax) {
                curMax = tmp;
            }
        }
        return arr;
    }

}
